Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using new method extractInteger for parsing instead of asInteger #901

Draft
wants to merge 1 commit into
base: Pharo13
Choose a base branch
from

Conversation

jordanmontt
Copy link
Contributor

Updated ordered list parsing with the method extractIntegerPart instead of asInteger. This PR requires the merging of pharo-project/pharo#17299.

@Ducasse
Copy link
Contributor

Ducasse commented Oct 30, 2024

I have no idea how to fix the broken tests.
I would prefer that Microdown is not used in Pharo.

#########################
# 2 tests did not pass: #
#########################

ReleaseTest
 ✗ #testUndeclared (151ms)
CollectionIsEmpty: a WeakIdentitySet() is empty
WeakIdentitySet(Collection)>>errorEmptyCollection
WeakIdentitySet(Collection)>>emptyCheck
WeakIdentitySet(Collection)>>anyOne
WeakIdentitySet(WeakSet)>>anyOne
[ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] in [ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] ] in [ "we compile a second method with the undeclared #undeclaredStubInstVar1 to trigger the code path of removing twice in #cleanOutUndeclared"
	self class compile: 'methodForTest ^undeclaredStubInstVar1'.
	Smalltalk cleanOutUndeclared.
	undeclaredVariables := Undeclared associations select: [ :each | each isUndeclaredVariable ].

	validExceptions := { #undeclaredStubInstVar1. #undeclaredStubInstVar2. #Gofer }. "The laste one is for Smalltalk CI and our external projects... But we should find a better solution at some point."

	"for now we filter by name, maybe filtering by variable would be better"
	remaining := undeclaredVariables reject: [ :each | validExceptions includes: each name ].

	"we look for one of the using methods of the undeclared var and report that,
	this should be enough to fix it quickly"
	description := String streamContents: [ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] ].

	self assert: remaining isEmpty description: description ] in ReleaseTest>>testUndeclared ...anyOne
Array(SequenceableCollection)>>do:
[ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
	description := String streamContents: [ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] ].

	self assert: remaining isEmpty description: description ] in ReleaseTest>>testUndeclared ...streamContents: [ :stream |
		               stream nextPutAll: 'Found undeclared Variables: '.
		               remaining do: [ :variable |
			               | method |
			               method := variable usingMethods anyOne.
			               stream cr
				               nextPutAll: variable name;
				               nextPutAll: ' in: ';
				               print: method methodClass;
				               nextPutAll: '>>';
				               print: method selector ] ]
FullBlockClosure(BlockClosure)>>ensure:
ReleaseTest>>testUndeclared ...ensure: [ self class removeSelector: #methodForTest ]
ReleaseTest(TestCase)>>performTest
 ✗ #testObsoleteClasses (831ms)
TestFailure: Obsolete classes remaining: an Array(AnObsoleteMicResourceReference AnObsoleteMicAbsoluteResourceReference AnObsoleteMicHTTPResourceReference AnObsoleteMicPharoImageResourceReference AnObsoleteMicrodownVisitor AnObsoleteMicArgumentList AnObsoleteMicMicrodownSharedPool AnObsoleteMicAbstractDelimiter AnObsoleteMicAnchorReferenceCloserDelimiter AnObsoleteMicAnchorReferenceOpenerDelimiter AnObsoleteMicAnnotationCloserDelimiter AnObsoleteMicAnnotationOpenerDelimiter AnObsoleteMicBoldDelimiter AnObsoleteMicFigureNameOpenerDelimiter AnObsoleteMicItalicDelimiter AnObsoleteMicLinkNameDelimiter AnObsoleteMicLinkNameCloserDelimiter AnObsoleteMicLinkNameOpenerDelimiter AnObsoleteMicMathDelimiter AnObsoleteMicMonospaceDelimiter AnObsoleteMicRawCloserDelimiter AnObsoleteMicRawOpenerDelimiter AnObsoleteMicStrikeDelimiter AnObsoleteMicElement AnObsoleteMicAbstractBlock AnObsoleteMicAbstractAnnotatedBlock AnObsoleteMicAnnotatedBlock AnObsoleteMicContinuousMarkedBlock AnObsoleteMicCommentBlock AnObsoleteMicQuoteBlock AnObsoleteMicTableBlock AnObsoleteMicListBlock AnObsoleteMicOrderedListBlock AnObsoleteMicUnorderedListBlock AnObsoleteMicListItemBlock AnObsoleteMicParagraphBlock AnObsoleteMicRootBlock AnObsoleteMicSingleLineBlock AnObsoleteMicAnchorBlock AnObsoleteMicHeaderBlock AnObsoleteMicHorizontalLineBlock AnObsoleteMicStartStopMarkupBlock AnObsoleteMicEnvironmentBlock AnObsoleteMicMetaDataBlock AnObsoleteMicSameStartStopMarkupBlock AnObsoleteMicAbstractCodeBlock AnObsoleteMicScriptBlock AnObsoleteMicPharoEvaluatorBlock AnObsoleteMicMathBlock AnObsoleteMicInlineElement AnObsoleteMicAnnotationBlock AnObsoleteMicInlineBlockWithUrl AnObsoleteMicFigureBlock AnObsoleteMicLinkBlock AnObsoleteMicTextBlock AnObsoleteMicInlineParser AnObsoleteMicrodownParser AnObsoleteMicRichTextBrush AnObsoleteMicRichTextIndentBrush AnObsoleteMicRichTextCanvas AnObsoleteMicRichTextCodeBlockStyler AnObsoleteMicTextStyler AnObsoleteMicRichTextComposer AnObsoleteMicRichTextDoIt AnObsoleteMicMorphicTextAdapter AnObsoleteMicMorphicMicrodownAdapter AnObsoleteMicScrolledTextMorph)
ReleaseTest(TestAsserter)>>assert:description:resumable:
ReleaseTest(TestAsserter)>>assert:description:
ReleaseTest>>testObsoleteClasses ...assert: obsoleteClasses isEmpty
		description: [
			String streamContents: [ :s|
				s
					nextPutAll: 'Obsolete classes remaining: ';
					print: obsoleteClasses ]]
ReleaseTest(TestCase)>>performTest


###########
# Summary #
###########

ReleaseTest
 ✗ #testUndeclared (151ms)
 ✗ #testObsoleteClasses (831ms)


  Executed 765 Tests with 1 Failures and 1 Errors in 62.56s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants